{extend name="public/base" /}
{block name="body"}
<!-- 内容区域 -->
<div class="content-wrapper">
    <!-- 修改模态框 -->
    <div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" style="top:20%;" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">×</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel">修改企业信息</h4>
                </div>
                <form id="editForm" method="post">
                    <div class="modal-body" style="height: 100%;text-align: center;">
                        <div class="form-group" style="text-align: center; height: 36px;">
                            <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">企业名称</label>
                            <div class="col-sm-9">
                                <input id="edit_name" class="form-control" name="name" maxlength="50" autoComplete="off">
                                <input id="edit_cID" type="hidden" name="cID" autoComplete="off">
                            </div>
                        </div>
                        <div class="form-group" style=" height: 36px;">
                            <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">企业类别</label>
                            <div class="col-sm-9">
                                <select id="edit_cClass" name="cClass" class="form-control" >
                                    <option value="合资">合资</option>
                                    <option value="独资">独资</option>
                                    <option value="国有">国有</option>
                                    <option value="私营">私营</option>
                                    <option value="全民所有制">全民所有制</option>
                                    <option value="集体所有制">集体所有制</option>
                                    <option value="股份制">股份制</option>
                                    <option value="有限责任制">有限责任制</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group" style=" height: 36px;">
                            <label for="firstname" style="height:34px; padding-top:1.2%;" class="col-sm-3 control-label">企业产品</label>
                            <div class="col-sm-9">
                                <input id="edit_cGoods" name="cGoods" class="form-control" maxlength="50" autoComplete="off">
                            </div>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="submit" class="btn btn-primary" onclick="editSubmit()">保存</button>
                        <button type="button" class="btn btn-default" data-dismiss="modal" onclick="reloadPage()">关闭</button>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!-- /修改模态框 -->

    <div class="content">
        {if condition="$Think.session.cVerify eq 2"}

        <div class="callout callout-warning">
            <h4>您还在审批中，审批通过后可解锁更多功能</h4>

            <p>您可以点击下方的修改信息，来修改待审批的企业信息</p>
            <p><button type="button" onclick="btnEdit()" class="btn btn-default">修改信息</button></p>
        </div>

        {elseif condition="$Think.session.cVerify eq 0"}
        <div class="callout callout-danger">
            <h4>抱歉，您的审批失败！审批通过后才可解锁更多功能</h4>

            <p>您可以点击下方的按钮，来重新提交企业信息进行审核</p>
            <p><button type="button" onclick="btnEdit()" class="btn btn-default">重新申报</button> </p>
        </div>

        {/if}

    </div>


</div>

<!-- 引入js依赖 -->
{include file="public/introduce" /}

<script>

    //唤起模态框，并填入数据
    function btnEdit(){
        var data = $.ajax({
           url: "../company/getCompany",
           method: "post",
           async: false,
        });
        // console.log(data);
        data = data.responseJSON;
        //填充行中对应数据到模态框中
        $("#edit_name").val(data.name);
        $("#edit_cID").val(data.cID);
        $("#edit_cGoods").val(data.cGoods);
        //唤起modal
        $("#editModal").modal();
    }


    //提交修改信息
    function editSubmit(){
        $.ajax({
            url: "../company/editCompany",
            type: "post",
            async: false,
            data: $('#editForm').serialize(),
        });
    }

</script>
</body>

</html>
<!---->

{/block}